<template>
  <div class="rank-list-content">
    <div class="rank-title">{{rank.title}}</div>
    <div class="rank-block">
      <div class="rank-item head">
        <div class="col-item rank">排名</div>
        <div class="col-item position">{{ rank.type==1?'职业':'地区' }}</div>
        <div class="col-item progressbar">{{ rank.type==1?'缺口数':'外出人数' }}</div>
        <div class="col-item num"></div>
        <div class="col-item iconfont"></div>
      </div>
      <div v-for="(item,index) in rank.data" :key="item.id" class="rank-item body">
        <div class="col-item rank" :class="index<3?'background':''">{{index+1}}</div>
        <div :style="rank.type==1?'':'justify-content:center'" class="col-item position">{{item.name}}</div>
        <div class="col-item progressbar">
          <div class="entity" :style="'width:'+((item.num/rank.data[0].num).toFixed(2)*100)+'%'"></div>
        </div>
        <div class="col-item num">{{item.num}}</div>
        <div class="col-item iconfont" :class="item.change"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "RankList",
  props:{
    rank:{
      type:Object,
    }
  }
}
</script>

<style lang="scss" scoped>
  .rank-list-content{
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    .rank-title{
      margin-top: 15px;
      width: 100%;
      color: #23ffff;
      font-size: 17px;
      text-align: center;
      font-weight: bold;
    }
    .rank-block{
      display: flex;
      flex-direction: column;
      .rank-item{
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        .col-item{
          display: flex;
          align-items: center;
          color: #fff;
          padding: 0 5px;
        }
        .col-item.rank{
          width: 50px;
          justify-content: center;
        }
        .col-item.position{
          width: 150px;
          margin-left: 20px;
        }
        .col-item.progressbar{
          flex-grow: 1;
        }
        .col-item.num{
          width:50px;
          justify-content: center;
          font-size: 14px;
        }
        .col-item.iconfont{
          width: 30px;
        }
        .col-item.iconfont.icon-jiantoushangsheng{
          color: #75de75;
        }
        .col-item.iconfont.icon-jiantouxiajiang{
          color: #ff4e4e;
        }
      }
      .rank-item.head{
        height: 35px;
        .col-item{
          justify-content: center;
          color: #2671BE;
          font-weight: bold;
          font-size: 17px;
        }
        .col-item.position{
          justify-content: flex-start;
        }
      }
      .rank-item.body{
        height: 30px;
        margin-bottom: 3px;
        .col-item.rank.background{
          background: #F36838;
          margin: 0 12.5px;
          width: 25px;
          height: 25px;
          border-radius: 4px;
          font-size: 14px;
        }
        .col-item.position{
          font-size: 14px;
          overflow: hidden;
          text-overflow:ellipsis;
          white-space: nowrap;
        }
        .col-item.progressbar{
          border-radius: 2px;
          padding: 0;
          border: 1px solid #77c7e6;
          height: 16px;
          .entity{
            background:#77c7e6;
            height: 100%;
          }
        }
      }
      .rank-item.body:last-child{
        margin-bottom: 0;
      }
    }
  }
</style>
